import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_douban/config/app_colors.dart';

class UserConfigView extends StatefulWidget {
  final String string;
  final String desStr;
  final Function method;
  const UserConfigView({Key? key, required this.string, required this.desStr,required this.method})
      : super(key: key);

  @override
  _UserConfigViewState createState() => _UserConfigViewState();
}

class _UserConfigViewState extends State<UserConfigView> {

  @override
  Widget build(BuildContext context) {
    return InkWell(
      child: Container(
        color: Colors.white,
        height: 55,
        padding: EdgeInsets.only(left: 15, right: 15),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          children: [
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                RichText(
                  text: TextSpan(
                    text: widget.string,
                    style: TextStyle(
                      fontSize: 14,
                      color: Colors.black,
                      decorationColor: Colors.black45,
                    ),
                    children: [
                      TextSpan(
                        text: widget.desStr == '' ? '          请选择' : '          ${widget.desStr}',
                        style: TextStyle(
                            fontSize: widget.desStr == '' ? 13 : 14,
                            color: widget.desStr == ''
                                ? Colors.grey
                                : Colors.black),
                      ),
                    ],
                  ),
                ),
                Image.asset(
                  'assets/images/common/arrow_white_right@2x.png',
                  width: 18,
                  height: 18,
                  color: Colors.black,
                )
              ],
            ),
            Container(
              color: AppColors.line,
              height: 1,
            )
          ],
        ),
      ),
      onTap: () {
        widget.method(widget.string);
      },
    );
  }
}
